import request from '../utils/request';

export default {
    //    用户相关==========================================================
    login(form) {
        return request({
            url: `/sys/login`,
            method: 'post',
            data: form
        });
    },
    getUserData(params) {
        return request({
            url: `/sys/user/list`,
            method: 'get',
            params: params
        });
    },
    getUserInfo(id) {
        return request({
            url: `sys/user/info/${id}`,
            method: 'get'
        });
    },
    saveUserInfo(user) {
        return request({
            url: `sys/user/${!user.userId ? 'save' : 'update'}`,
            method: 'post',
            data: user
        });
    },

//    字典==========================================================
    getDictionaryData(params) {//获取字典数据
        return request({
            url: `/dictionary/list`,
            method: 'post',
            data: params
        });
    },
    saveDictionaryConfig(dictionaryConfig) {//保存、修改字典数据
        return request({
            url: `dictionary/${!dictionaryConfig.id ? 'save' : 'update'}`,
            method: 'post',
            data: dictionaryConfig
        });
    },
    deleteDictionaryConfig(ids) {//删除字典数据
        return request({
            url: `dictionary/delete`,
            method: 'delete',
            data: ids
        });
    },
    getDictionaryConfigById(id) {//获取字典数据
        return request({
            url: `dictionary/info/${id}`,
            method: 'get'
        });
    },
//    FAQ==========================================================
    getFaqData(params) {
        return request({
            url: `/faq/list`,
            method: 'post',
            data: params
        });
    },
    saveFaq(faq) {
        return request({
            url: `faq/${!faq.id ? 'save' : 'update'}`,
            method: 'post',
            data: faq
        });
    },
    deleteFaq(ids) {
        return request({
            url: `faq/delete`,
            method: 'delete',
            data: ids
        });
    },
    getFaqById(id) {
        return request({
            url: `faq/info/${id}`,
            method: 'get'
        });
    },
    upload(file) {
        return request({
            headers: {
                'Content-Type': 'multipart/form-data'
            },
            url: `file/upload`,
            method: 'post',
            data: file
        });
    },
//    新闻===========================================================
    getNewsData(params) {
        return request({
            url: `/news/list`,
            method: 'post',
            data: params
        });
    },
    saveNews(news) {
        return request({
            url: `news/${!news.id ? 'save' : 'update'}`,
            method: 'post',
            data: news
        });
    },
    deleteNews(ids) {
        return request({
            url: `news/delete`,
            method: 'delete',
            data: ids
        });
    },
    getNewsById(id) {
        return request({
            url: `news/info/${id}`,
            method: 'get'
        });
    },
//    教师===========================================================
    getTeacherInfoData(params) {
        return request({
            url: `/teacher/list`,
            method: 'post',
            data: params
        });
    },
    saveTeacherInfo(teacherInfo) {
        return request({
            url: `teacher/${!teacherInfo.id ? 'save' : 'update'}`,
            method: 'post',
            data: teacherInfo
        });
    },
    deleteTeacherInfo(ids) {
        return request({
            url: `teacher/delete`,
            method: 'delete',
            data: ids
        });
    },
    getTeacherInfoById(id) {
        return request({
            url: `teacher/info/${id}`,
            method: 'get'
        });
    },
//    学生报名===========================================================
    getEnrollmentInfoData(params) {
        return request({
            url: `/enrollment/list`,
            method: 'post',
            data: params
        });
    },
    saveEnrollmentInfo(enrollmentInfo) {
        return request({
            url: `enrollment/${!enrollmentInfo.id ? 'save' : 'update'}`,
            method: 'post',
            data: enrollmentInfo
        });
    },
    deleteEnrollmentInfo(ids) {
        return request({
            url: `enrollment/delete`,
            method: 'delete',
            data: ids
        });
    },
    getEnrollmentInfoById(id) {
        return request({
            url: `enrollment/info/${id}`,
            method: 'get'
        });
    },
    exportStudents() {
        return request({
            url: `enrollment/export`,
            method: 'get',
            responseType: 'blob'
        });
    },
    //    标签===========================================================
    getTagsData() {
        return request({
            url: `/tags/listAll`,
            method: 'post'
        });
    },
    saveTags(tags) {
        return request({
            url: `tags/save`,
            method: 'post',
            data: tags
        });
    },
    deleteTags(ids) {
        return request({
            url: `tags/delete`,
            method: 'delete',
            data: ids
        });
    },
    //    照片墙===========================================================
    getPhotoWallData() {
        return request({
            url: `/photo/listAll`,
            method: 'post'
        });
    },
    savePhotoWall(photoWall) {
        return request({
            url: `photo/save`,
            method: 'post',
            data: photoWall
        });
    },
    deletePhotoWall(ids) {
        return request({
            url: `photo/delete`,
            method: 'delete',
            data: ids
        });
    },
    //    文件===========================================================
    getFileListData(params) {
        return request({
            url: `/file/list`,
            method: 'post',
            data: params
        });
    }

};
